package regexdemo;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexDemo1 {
    public static void main(String[] args) {
        String s = "java自从95年问世以来，经历了很多版本，" +
                "目前企业中用的最多的是Java8和JAva11 ," +
                "因为这两个是长期支持版本，下一个长期支持版本是JAVa17，" +
                "相信在未来不久JAVA17也会逐渐登上历史舞台 " +
                "abbbbbbbbbbbbbbbbbbbbbbbaaaaaaaa";

        String regex1 = "((?i)Java)(?=8|11|17)";
        String regex2 = "((?i)Java)(8|11|17)";
        String regex3 = "((?i)Java)(?:8|11|17)";
        String regex4 = "((?i)Java)(?!8|11|17)";
        String regex5 = "ab+?";

        Pattern p = Pattern.compile(regex5);
        Matcher m = p.matcher(s);
        while(m.find())
        {
            System.out.println(m.group());
        }
    }
}
